<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
      <head>
        <title>GPS Testing</title>
        <script "text/javascript">
     
          // called when location object changes
          function locationCB()
          {
             alert("Latitude "  +
                 blackberry.location.latitude);
             alert("Longitude " +
                 blackberry.location.longitude);
             return true;
         }
    
         // test to see if the blackberry location API is supported
         if( window.blackberry && blackberry.location.GPSSupported) {
               document.write("GPS Supported");
    
   
               // Set our call back function
               
               //WRONG: this would call our call back function immediatly, not after the refresh
               //blackberry.location.onLocationUpdate(locationCB());
               
               //WRONG: the blackberry browser won't support passing a method.
               //It will error on refresh and all javascript processing on the page will stop
               //blackberry.location.onLocationUpdate(locationCB());
               
               
               // RIGHT: pass a string that calls our method
               blackberry.location.onLocationUpdate("locationCB()");
               
               // set to Autonomous mode
               blackberry.location.setAidMode(2);
           
               //refresh the location
               blackberry.location.refreshLocation();
         }    
         else
         {
           document.write("This Device doesn't support the Blackberry Location API");
         }
       </script>
    
     </head>
     <body>
     </body>
   </html>